<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'login.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
      <%--<script type="text/javascript" src="<%=basePath%>/common/js/jquery-1.9.js"></script>--%>

      <%--<link href="is/upload/offlinepay/pos_style.css" rel="stylesheet" type="text/css" />--%>
      <%--<link href="js/upload/offlinepay/style.css" rel="stylesheet" type="text/css" />--%>
      <%--<link href="js/upload/offlinepay/uploadify.css" rel="stylesheet" type="text/css" />--%>
      <script src="js/upload/offlinepay/script3102.js" type="text/javascript"></script>
      <script src="js/upload/offlinepay/jquery.min.js" type="text/javascript"></script>
      <script src="js/upload/offlinepay/jquery.uploadify.js" type="text/javascript"></script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<script type="application/javascript">

        <%--$("#uploadify").uploadify({--%>
            <%--//指定swf文件--%>
            <%--'swf':  '<s:url value="/swf/uploadify.swf"/>',--%>
            <%--//后台处理的页面--%>
            <%--'uploader': 'uploads',--%>
            <%--//按钮显示的文字--%>
            <%--'buttonText': '上传图片',--%>
            <%--//显示的高度和宽度，默认 height 30；width 120--%>
            <%--//'height': 15,--%>
            <%--//'width': 80,--%>
            <%--//上传文件的类型  默认为所有文件    'All Files'  ;  '*.*'--%>
            <%--//在浏览窗口底部的文件类型下拉菜单中显示的文本--%>
            <%--'fileTypeDesc': 'Image Files',--%>
            <%--//允许上传的文件后缀--%>
            <%--'fileTypeExts': '*.gif; *.jpg; *.png',--%>
            <%--//发送给后台的其他参数通过formData指定--%>
            <%--//'formData': { 'someKey': 'someValue', 'someOtherKey': 1 },--%>
            <%--//上传文件页面中，你想要用来作为文件队列的元素的id, 默认为false  自动生成,  不带#--%>
            <%--//'queueID': 'fileQueue',--%>
            <%--//选择文件后自动上传--%>
            <%--'auto': true,--%>
            <%--//设置为true将允许多文件上传--%>
            <%--'multi': true,--%>
            <%--'onUploadSuccess':function(file,data,response){--%>
               <%--alert(data);--%>
            <%--}--%>
        <%--});--%>
       /* $("#uploadify").uploadify({
            'successTimeout' : 120,
            swf: '<s:url value="/swf/uploadify.swf"/>',
            uploader: '<s:url value="/uploads.action"/>',
            'fileObjName':'uploadify',
            formData: {

                fileType:'',
                'synuploadify':'synuploadify'
            },
            buttonText: '选择文件',
            fileSizeLimit: '200MB',
            fileTypeDesc: 'Image Files',
            fileTypeExts: '*.zip;*.rar;',
            'overrideEvents' : [ 'onDialogClose', 'onSelectError','onUploadError'],
            'onSelectError' : uploadify_onSelectError,
            'onUploadError' : uploadify_onUploadError,
            auto: true,
            multi: false,
            onUploadSuccess:function(file,data,response){
                    alert(data);
            },

        });
    },10);*/
    var uploadify_onSelectError = function(file, errorCode, errorMsg) {
        var msgText = "上传失败\n";
        switch (errorCode) {
            case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
                //this.queueData.errorMsg = "每次最多上传 " + this.settings.queueSizeLimit + "个文件";
                msgText += "每次最多上传 " + this.settings.queueSizeLimit + "个文件";
                break;
            case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
                msgText += "文件大小超过限制( " + this.settings.fileSizeLimit + " )";
                break;
            case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
                msgText += "文件大小为0";
                break;
            case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
                msgText += "文件格式不正确，仅限 " + this.settings.fileTypeExts;
                break;
            default:
                msgText += "错误代码：" + errorCode + "\n" + errorMsg;
        }
        alert(msgText);
    };

    var uploadify_onUploadError = function(file, errorCode, errorMsg, errorString) {
        // 手工取消不弹出提示
        if (errorCode == SWFUpload.UPLOAD_ERROR.FILE_CANCELLED
                || errorCode == SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED) {
            return;
        }
        var msgText = "上传失败\n";
        switch (errorCode) {
            case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
                msgText += "HTTP 错误\n" + errorMsg;
                break;
            case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
                msgText += "上传文件丢失，请重新上传";
                break;
            case SWFUpload.UPLOAD_ERROR.IO_ERROR:
                msgText += "网络异常，请稍后重试";
                break;
            case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
                msgText += "安全性错误\n" + errorMsg;
                break;
            case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
                msgText += "每次最多上传 " + this.settings.uploadLimit + "个";
                break;
            case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
                msgText += errorMsg;
                break;
            case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
                msgText += "找不到指定文件，请重新操作";
                break;
            case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
                msgText += "参数错误";
                break;
            default:
                msgText += "文件:" + file.name + "\n错误码:" + errorCode + "\n"
                        + errorMsg + "\n" + errorString;
        }
        alert(msgText);
    };
    function set(a,b){
        var url ="uploads.action?a="+a+"&b="+b;
        $("#uploadify").uploadify({
            'successTimeout' : 120,
            swf: '<s:url value="/swf/uploadify.swf"/>',
            uploader: url,
            'fileObjName':'uploadify',
            formData: {
                fileType:'',
                'synuploadify':'synuploadify'
            },
            buttonText: '选择文件',
            fileSizeLimit: '200MB',
            fileTypeDesc: 'Image Files',
            fileTypeExts: '*.zip;*.rar;',
            'overrideEvents' : [ 'onDialogClose', 'onSelectError','onUploadError'],
            'onSelectError' : uploadify_onSelectError,
            'onUploadError' : uploadify_onUploadError,
            auto: true,
            multi: false,
            onUploadSuccess:function(file,data,response){
                alert(data);
            },

        });

    };
</script>
  </head>
  
  <body>
  11111111111
    <form action="login" method="post"  theme="simple" enctype="multipart/form-data">
    	用户名:<input type="text" name="u.userName"/><br/>
    	密码:<input type="text" name="u.password"/><br/>

    	<input type="submit" value="登陆"/>
    </form>
  22222222222222
    <form action="login2" method="post">
        id:<input type="text" name="id"/><br/>
       name:<input type="text" name="name"/><br/>
        <input type="submit" value="登陆"/>
    </form>

    头像:<input type="file" name="uploadify" id="uploadify" onclick="set(1,2)"/><br/>

  </body>
</html>
